<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body style="font-family:Arial, Helvetica, sans-serif">
<table width="700" border="1" cellspacing="0" cellpadding="15">
  <tr>
    <th align="left" scope="col"><form id="form1" name="form1" method="post" action="">
      Barcode:<select name = "code_product">
      			<option selected disabled>Please Select</option>
      		<?php foreach ($this->barcodeList as $k => $v){?>
      			<option value = "<?php echo $v['item_code']?>"><?php echo $v['item_description']?></option>
      		<?php }?>
      
      </select>
      			or Choose Category<br/><br/>
      Category<select name = "category_product">
      			<option selected disabled>Please Select</option>
      		<?php foreach ($this->category as $k => $v){?>
      			<option value = "<?php echo $v['code_type']?>"><?php echo $v['comment_type']?></option>
      		<?php }?>
      </select>
      
      <input type="submit" name="btn_show_loc" id="btn_show_loc" value="Show Location" />
    </form></th>
  </tr>
</table>
<table width="700" border="1" cellspacing="0" cellpadding="10" style="font-size:15px;">
<?php if(empty($this->pList)){?>
  <tr>
    <th align="left" scope="col"><?php echo $this->codeProduct;?></th>
    <?php $description = $this->desProduct;?>
    <th colspan = "2" align="left" scope="col"><?php echo $description['item_description'];?></th>
  </tr>
  <tr>
    <td style="width:120px;"><strong>Pick Up<br />
    Location</strong></td>
    <td>
    <?php
    if(!empty($this->locList)){
   	   foreach($this->locList as $k => $v){
		if( $v['type_location'] == "PL"){
			echo $v['code_location']." <a href=\"/stock/remove-product-location/org/epl/barcode/{$this->codeProduct}/location/{$v['code_location']}\" onclick=\"return confirm('Are You Sure To Remove {$this->codeProduct} Form Location : {$v['code_location']} ?')\" ><img src=\"/im/remove16.jpg\" width=\"16\" height=\"16\" border=\"0\" /></a><br />";
			}
	   }
    }else{
    	echo "Null Location";
    }
	?>
	
	
</td>

    <td style="width:220px;"><form id="form_pl" name="form_pl" method="post" action="/stock/add-product-location/org/epl">
      <img src="/im/add30.jpg" width="30" height="30" />
      <input name="code_product" type="hidden"  value="<?php echo $this->codeProduct;?>" />
      <input type="text" name="code_location" id="code_location" style="width:100px;" />
      <input type="submit" name="btn_add" id="btn_add" value="Add" />
    </form></td>
  </tr>
<?php }else{$i = 1;?>
				<tr>
					<th>No.</th>
					<th>Barcode</th>
					<th>Description</th>
					<th>PickUp Location</th>
					<th>Edit Location</th>
				</tr>

		<?php 
			foreach ($this->pList as $k => $v){
						$item = new Model_Products_Itemdetail();
						$itemDetail = $item->getItem($v['code_location']);
					?>
				<tr>
					<td><?php echo $i++;?></td>
					<td><?php echo $k?></td>
					<td><?php echo $v['code_location']?></td>
					<td><?php echo $itemDetail['item_description']?></td>
					<td style="width:220px;"><form id="form_pl" name="form_pl" method="post" action="/stock/add-product-location/org/epl">
     					 <img src="/im/add30.jpg" width="30" height="30" />
     					 <input name="code_product" type="hidden"  value="<?php echo $v['code_product']?>" />
      					 <input type="text" name="code_location" id="code_location" style="width:100px;" />
      					 <input type="submit" name="btn_add" id="btn_add" value="Add" />
    					 </form></td>
				</tr>
			
		<?php	}?>
<?php }?>
</table><br />
<br />

</body>
</html>